package com.example.first;

import androidx.appcompat.app.AppCompatActivity;

import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;

public class ScoreActivity extends AppCompatActivity implements View.OnClickListener {
  TextView v1,v5;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_score);
        v1=(TextView) findViewById(R.id.textView3);
        v5=(TextView)findViewById(R.id.t5) ;
        Button b1 = (Button) findViewById(R.id.button5);
        Button b2 = (Button) findViewById(R.id.button6);
        Button b3 = (Button) findViewById(R.id.button7);
        Button b4 = (Button) findViewById(R.id.b4);
        Button b5 = (Button) findViewById(R.id.b8);
        Button b6 = (Button) findViewById(R.id.b9);
        Button b7 = (Button) findViewById(R.id.b10);
        b1.setOnClickListener(this);
        b2.setOnClickListener(this);
        b3.setOnClickListener(this);
        b4.setOnClickListener(this);
        b5.setOnClickListener(this);
        b6.setOnClickListener(this);
        b7.setOnClickListener(this);
    }


    @Override
    public void onClick(View b) {
            String v2= v1.getText().toString();
            String v6=v5.getText().toString();
            int v7=Integer.valueOf(v6);
            int v3= Integer.valueOf(v2);
           switch (b.getId()) {
               case R.id.button5:
                   v3 = v3 + 3;
                   break;
               case R.id.button6:
                   v3 = v3 + 2;
               case R.id.button7:
                   v3 = v3 + 1;
                   break;
               case R.id.b8:
                   v7 = v7 + 3;
                   break;
               case R.id.b9:
                   v7 = v7 + 2;
                   break;
               case R.id.b10:
                   v7 = v7 + 1;
                   break;
               case R.id.b4:
                   v3 = 0;
                   v7 = 0;
                   break;
           }
            String v4 = Integer.toString(v3);
        String v8=Integer.toString(v7);
            v1.setText(v4);
            v5.setText(v8);
        }
    }

